<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: j
  Date: 2021/11/22
  Time: 8:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="static/bootstrap4/css/bootstrap.css">
    <script src="static/js/jquery-3.2.1.js"></script>
    <script src="static/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="static/bootstrap4/js/bootstrap.js"></script>
    <script src="/static/My97DatePicker/WdatePicker.js"></script>
    <title>Title</title>

</head>
<body>
    <div>
        欢迎${user.userName}登录
    <form>
        订单编号:<input name="oid" value="${vo.oid}">
        <select name="c1">
        <option value="">请选择</option>
        <option value="odate" ${vo.c1=='odate'?'selected':''}>下单时间</option>
    </select>

        <input name="p1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly value="<fmt:formatDate value="${vo.p1}" pattern="yyyy-MM-dd"></fmt:formatDate>">
      - <input name="p2" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly  value="<fmt:formatDate value="${vo.p2}" pattern="yyyy-MM-dd"></fmt:formatDate>">


      备注:<input name="remark" value="${vo.remark}"><br>
     <select name="c2">
         <option value="">请选择</option>
         <option value="credit" ${vo.c2=='credit'?'selected':''}>制单人</option>
         <option value="warsehouse" ${vo.c2=='warsehouse'?'selected':''}>仓库</option>
         <option value="location" ${vo.c2=='location'?'selected':''}>库位</option>
         <option value="orderer" ${vo.c2=='orderer'?'selected':''}>订货人</option>
         <option value="tracking_number" ${vo.c2=='tracking_number'?'selected':''}>物流单号</option>
         <option value="address" ${vo.c2=='address'?'selected':''}>交货地点</option>
     </select>
      <input name="p3" value="${vo.p3}">

        <select name="c3">
        <option value="">请选择</option>
        <option value="sum" ${vo.c3=='sum'?'selected':''}>总金额</option>
        <option value="discount_amount" ${vo.c3=='discount_amount'?'selected':''}>折让金额</option>
        <option value="cost" ${vo.c3=='cost'?'selected':''}>附件成本</option>
    </select>
    <input name="z1" value="${vo.z1}">
    -<input name="z2" value="${vo.z2}">

     <input type="hidden" name="str" value="${vo.str}">
     <input type="hidden" name="str1"value="${vo.str1}">
    排序:<a href="javascript:void(0)" onclick="px('odate')">下单时间</a>
    <a href="javascript:void(0)" onclick="px('sum')">总金额</a>
        <input type="button" value="查询" onclick="goPage(1)">
    </form>
    </div>
    <table class="table">
     <tr>
         <td>选择</td>
         <td>下单时间</td>
         <td>订单编号</td>
         <td>制单人</td>
         <td>仓库</td>
         <td>库位</td>
         <td>订货人</td>
         <td>总金额</td>
         <td>折让金额</td>
         <td>交货方式</td>
         <td>物流单号</td>
         <td>附件成本</td>
         <td>交货地点</td>
         <td>备注</td>
         <td>操作</td>
     </tr>
        <c:forEach items="${pg.list}" var="l">
         <tr>
             <td>checkout</td>
             <td>
              <fmt:formatDate value="${l.odate}" pattern="yyyy-MM-dd"></fmt:formatDate>
               </td>
             <td>${l.oid}</td>
             <td>${l.credit}</td>
             <td>${l.warsehouse}</td>
             <td>${l.location}</td>
             <td>${l.orderer}</td>
             <td>${l.sum}</td>
             <td>${l.discountAmount}</td>
             <td>${l.way}</td>
             <td>${l.trackingNumber}</td>
             <td>${l.cost}</td>
             <td>${l.address}</td>
             <td>${l.remark}</td>
             <td>

<%--                 <a href="./selectById?oid="${l.oid}>修改</a>--%>

                 <input type="button" value="修改" onclick="selectById(${l.oid})">
                 </td>
         </tr>
        </c:forEach>
    </table>
    <div>
        <jsp:include page="/static/common/pages.jsp"></jsp:include>
    </div>
    <script>
        function selectById(oid){
            var url="./selectById?oid="+oid;
            $("#nav-tabContent").load(url);
        }
        function goPage(pageNum){
           //queryAll("list?pageNum="+pageNum+"&"+$('form').serialize())

            $("#nav-tabContent").load("list?pageNum="+pageNum+"&"+$('form').serialize());
        }
        function px(ss){
            //排序
        var v=  $("[name='str1']").val();
        if (v=='asc'){
            $("[name='str1']").val('desc');
        }else {
            $("[name='str1']").val('asc');
        }
        $("[name='str']").val(ss);
        //提交表单
          goPage(1);
        }
    </script>
</body>
</html>
